package com.qijian.maindata.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qijian.maindata.domain.ProcessFileViewHistory;
import com.qijian.maindata.domain.vo.ProcessFileViewGroupVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProcessFileViewHistoryMapper extends BaseMapper<ProcessFileViewHistory> {

    /**
     * 获取工单是否绑定了文件
     */
    @Select("select storage_id,count(1) as cnt from main_process_file_view_history " +
            "where is_del=0 and process_id=#{processId} and wu_id=#{wuId} and user_id=#{userId} " +
            "group by storage_id")
    List<ProcessFileViewGroupVo> findStorageGroupList(@Param("processId") Long processId,@Param("wuId") Long wuId, @Param("userId") Long userId);

    int saveView(@Param("viewHistory") ProcessFileViewHistory viewHistory);
}
